package com.dustedpixels.jasmin.chips.z80;

/**
 * The Z80 context (environment the Z80 is running in).
 * <p>
 * Warning: This interface is designed for use by user code, and not for
 * implementation by user code. New methods may be added to this interface in
 * the future. To guarantee forward compability, implementations should extend
 * Z80ContextImplBase class.
 */
public interface Z80Context {
    /**
     * Writes specified value under specified memory address.
     * 
     * @param address The address.
     * @param value The value.
     */
    void poke(short address, byte value);

    /**
     * Reads a value from specified memory address.
     * 
     * @param address The address.
     * @returns The value.
     */
    byte peek(short address);

    /**
     * Writes specified value to the specified port.
     * 
     * @param port The port.
     * @param value The value.
     */
    void out(short port, byte value);

    /**
     * Reads a value from specified port.
     * 
     * @param port The port.
     * @returns The value.
     */
    byte in(short port);

    /**
     * Returns true, if the NMI line is active.
     */
    boolean isNMIActive();

    /**
     * Returns true, if the IRQ line is active.
     */
    boolean isIRQActive();

    /**
     * Returns true, if the RESET line is active.
     */
    boolean isResetActive();

    /**
     * Returns true, if the WAIT line is active.
     */
    boolean isWaitActive();

    /**
     * Returns true, if none of the lines are active. This method can
     * be used for optimization.
     */
    boolean noLinesActive();

}
